import { Controller } from 'egg';

export default class ClockController extends Controller {
    public async clock() {
        const { ctx, service, app } = this;
        ctx.validate({
            ordered_schedule_id: 'number',
        });
        await service.db.orderedSchedule.update({
            id: ctx.request.body.ordered_schedule_id,
            clocked: 1,
            clocked_at: app.mysql.literals.now,
        });
        ctx.helper.success(ctx);
    }
}
